class VoiceRecord {
  final String id;
  final String deviceId;
  final String deviceName;
  final String fileUrl;
  final DateTime createTime;
  final int duration;
  final String status;

  VoiceRecord({
    required this.id,
    required this.deviceId,
    required this.deviceName,
    required this.fileUrl,
    required this.createTime,
    required this.duration,
    required this.status,
  });

  factory VoiceRecord.fromJson(Map<String, dynamic> json) => VoiceRecord(
    id: json['id'] as String,
    deviceId: json['deviceId'] as String,
    deviceName: json['deviceName'] as String,
    fileUrl: json['fileUrl'] as String,
    createTime: DateTime.parse(json['createTime'] as String),
    duration: json['duration'] as int,
    status: json['status'] as String,
  );

  Map<String, dynamic> toJson() => {
    'id': id,
    'deviceId': deviceId,
    'deviceName': deviceName,
    'fileUrl': fileUrl,
    'createTime': createTime.toIso8601String(),
    'duration': duration,
    'status': status,
  };
}